<?php
		direct_url();
		//-------------------------- GET TRUYEN ----------------
	
		$url=HOME.'truyentranh/danhsach/';
		$og_url=HOME.'truyentranh/danhsach/';
		$where="";
		$order="";
		$title="";
		if(isset($_GET['ext'])){
			$url=HOME.'danhsach/'.$_GET['ext'].'/';
			$og_url=HOME.'danhsach/'.$_GET['ext'];
			 switch($_GET['ext']){
			 
				case 'other': $where="where alias NOT RLIKE '^[A-Za-z]' and duyet=1"; $title='Ký Tự Khác'; break;
				default: $where="where alias  LIKE '".$_GET['ext']."%' and duyet=1"; $title=' Bắt đầu bằng ký tự '.$_GET['ext']; break;
			 }
		}
		
		
		$cache=new Cache;
		if($where){
		$sql ="select id,name,hinhanh, theloai, gioithieu, alias,tinhtrang,ep_moinhat,ep_moinhaturl,views,nguon from anime ".$where." order by name asc";
		$sql2="select id from anime ".$where;
		}else{
		$sql ="select id,name,hinhanh, theloai, gioithieu, alias,tinhtrang,ep_moinhat,ep_moinhaturl,views,nguon from anime order by name asc";
		$sql2="select id from anime";
		}
		
		
		
		if(!isset($_GET['ext'])){
		$pager = new Pagination($sql,50,5,$url,3600);
		}else{
		$pager = new Pagination($sql,150,5,$url,3600);
		}
		$pager->setDebug(false);
		$data['info'] = $pager->paginate($cache,$sql2);
		$data['nav']	= $pager->renderFullNav();
		
	
			if($title == "") $title = " - Đọc truyện online - " . DOMAIN_NAME;
		
			$data1[title]=web_title("Danh sách Truyện tranh ".$title);
			$data1['mota']=web_des("Danh sách Truyện Tranh ".$title." Trên Truyencuatui");
			$data1['keyword']=web_keyword("danh sach truyen tranh,truyen tranh,truyen tranh online, doc truyen tranh online,truyencuatui".",".$title);
			loadview('template/header2',$data1);
			loadview("anime/list_anime_danhsach",$data);
			loadview('template/footer2');
			exit();
			
			
